import { t } from 'i18next'
export interface ISelectItem {
	label: string
	value: string
}
export const actionRepeatOrder: { [key: string]: string } = {
	focusIn: 'CAMERA_CTRL_FOCUSIN',
	focusOut: 'CAMERA_CTRL_FOCUSOUT',
	autofocus: 'CAMERA_CTRL_AUTOFOCUS',
	zoomIn: 'CAMERA_CTRL_ZOOMIN',
	zoomOut: 'CAMERA_CTRL_ZOOMOUT',
	brightDown: 'CAMERA_CTRL_BRIGHTDOWN',
	brightUp: 'CAMERA_CTRL_BRIGHTUP',
	cameraMoveUp: 'CAMERA_CTRL_UP',
	cameraMoveDown: 'CAMERA_CTRL_DOWN',
	cameraMoveLeft: 'CAMERA_CTRL_LEFT',
	cameraMoveRight: 'CAMERA_CTRL_RIGHT',
}
export const getPositionList = () => {
	let arr: ISelectItem[] = [{ label: t('请选择'), value: '-1' }]
	for (let i = 0; i++ < 6; ) {
		arr.push({ label: String(i), value: String(i - 1) })
	}
	return arr
}
export const getVideoSourceList = () => {
	let arr: ISelectItem[] = [{ label: t('请选择'), value: '-1' }]
	for (let i = 0; i++ < 6; ) {
		arr.push({ label: String(i), value: String(i) })
	}
	return arr
}
export interface CameraPosInfoData {
	mt: {
		mt_id: string
		mcu_idx: string
	}
	channels: {
		chn_id: string
		pos_info: {
			name: string
			pos: string
		}[]
	}[]
}
export const isSameList = (newData: CameraPosInfoData, oldData: CameraPosInfoData) => {
	let newList = newData.channels[0].pos_info
	let oldList = oldData.channels[0].pos_info
	if (oldList.length !== newList.length) {
		return false
	} else {
		for (var i = 0, lng = oldList.length; i < lng; i++) {
			var newPos = newList[i]
			var oldPos = oldList[i]
			if (newPos.pos !== oldPos.pos || newPos.name !== oldPos.name) {
				return false
			}
		}
		return true
	}
}
export interface IMonitorFailData {
	err_code: string
	mt_id: string
	dst_addr: {
		ip: string
		port: string
	}[]
}
